/*
 * @Author: huangyingli
 * @Date: 2023-02-08 14:15:08
 * @LastEditors: huangyingli
 * @LastEditTime: 2023-02-22 19:31:06
 * @Description:
 */
import { Outlet } from 'react-router-dom';
import { useBeforeRouteEach } from '../../hooks/routeHook';
import { Spin } from 'antd';
import { useSelector } from 'react-redux';
import { getLoading, getIsLogin } from '../../redux/common';
import style from './main.module.less';

import Menu from '../../components/menu'
export default function Welcom() {
  const loading = useSelector(getLoading);
  const isLogin = useSelector(getIsLogin);
  useBeforeRouteEach();

  if (isLogin) {
    return (
      <Spin spinning={loading}>
        <div className={style.layout}>
          <div className={style.nav}></div>

          <div className={style.content}>
            <div className={style.menu}>
              <Menu></Menu>
            </div>
            <div className={style.page}>
              <Outlet />
            </div>
          </div>
        </div>
      </Spin>
    );
  }
}
